In order to program a memory, it is desirable to understand how it must control a programmable controller. The task of a programmable controller is to compute the logic status represented by interconnected contacts and to apply the end result of such logic computation to a coil to either energize or deenergize it or to send such result to the outside to control external devices such as solenoids, for example.
This logic and the interconnected contacts represented thereby is illustrated by a diagram. The convention used in such diagram is based on the standard practice used to represent electro-mechanical relay logic and is retained in programmable controller applications because of the widespread familiarity with this type of diagram, commonly termed a ladder diagram because each set of logic that corresponds to one output resembles the rung of a ladder. That is, in a ladder diagram, the left and right verticals are the power lines and the horizontal "rungs" are the sets of logic representing the control elements such as interconnected contacts as shown in FIG. 1.
In an electromechanical relay ladder diagram, the direction of logic is from the left hand vertical 110 volt A.C. power line flowing through the contacts and coils to the right hand vertical power line. The programmable controller emulates this action, but there are quite significant differences between the internal functions of the programmable controller and the relay system that it replaces. Among these are:
1. In the relay system, the logic actions occur in parallel or simultaneously through the rungs of the ladder. In the programmable controller, these logic actions are computed sequentially, one contact at a time.
2. In the programmable controller, the external contacts are not an actual part of the logic, as are the pushbuttons and limit switches of the relay system, but rather power signals therefrom are brought into the programmable controller and then "relayed" through isolators to become inputs signals. The programmable controller then treats these external contacts in the same manner as internal contacts except as controlled by an input signal rather than by a coil.
3. There are no L1 or L2 power lines for the logic section of the control even though two vertical lines may be drawn on a programmable controller diagram. In the latter, there is a logic flow from the left line to the right line rather than a power flow as in the relay system ladder diagram.
4. In the programmable controller, the results of logic actions are "relayed" out through such devices as photo-isolators and Triacs in order to control external devices.
In view of the above, the functions of programmable controllers can be actually grouped into three sections: (1) the input section consisting of the power source from line L1-L2 and connections through limit switches and pushbuttons to the input terminals of the controller; (2) the logic section based on internal processing resembling to a great degree computer-like functions; and (3) the output section where logic function results control external devices connected to the output terminals of the controller and power lines L1-L2.
As stated previously, the logic task consists of determining the state of a signal coming from a set of interconnected contacts, based both on how the contacts are interconnected and the states of the individual contacts, open or closed. There are only two basic contact connections to be considered: the series connection and the parallel connection. For a series connection of three normally-open contacts 1, 2 and 3, the logic action is: a logic signal will flow from left to right and be present at the "output" if, and only if, all three contacts are closed. This is the equivalent of an AND-logic operation, that is a logic "1" is obtained if Contact-1 and Contact-2 and Contact-3 are closed.
But more precisely, one does not think in terms of contacts being open or closed but rather whether the devices controlling the contacts are energized or deenergized. This leads to the concept of normally-open (N.O.) and normally-closed (N.C.) contacts. For three series contacts controlled by coils 1CR, 2CR and 3CR, where reference is made to the control coils controlling the contacts and where that contact controlled by coil 3CR is normally-closed, the logic action is now described as follows: a logic "1" signal is obtained if, and only if, coils 1CR and 2CR are energized and coil 3CR is deenergized. The logic equivalent of labeling a contact as normally closed is the NOT-logic operation.
For three parallel contacts of coils 1CR, 2CR and 3CR where the first two contacts are N.O. and the third contact is N.C., the logic action is: a logic output of "1" is obtained if, and only if, either coil 1CR or 2CR is energized or if coil 3CR is deenergized. This is commonly regarded as equivalent to the OR-logic operation.
Programmable controllers compute the logic represented by series and parallel contacts through sequential instructions placed into a memory. Each instruction has a portion indicating the type of operation to be performed, series or parallel, and a reference number defining where the internal processor is to go to find the status of the device (input or coil) controlling the contact. The programmer must determine and write these instructions according to the manner in which the contacts are interconnected.
Programming is quite simple for contacts in series. One could write three instructions for the aforementioned series N.O., N.O., and N.C. contacts thus:
SERIES N.O. 1CR PA1 SERIES N.O. 2CR PA1 SERIES N.C. 3CR PA1 OR N.O. 1CR PA1 OR N.O. 2CR PA1 OR N.C. 3CR PA1 SERIES N.O. 1CR PA1 SERIES N.C. 2CR PA1 OR N.O. 3CR PA1 SERIES N.O. 4CR PA1 OR N.O. 5CR
where "SERIES" indicates the type of internal action to be performed, actually an AND-logic operation, and 1CR, 2CR, and 3CR are the "reference numbers" for the internal control coils energizing the "contacts". As seen above, the instructions are also "tagged" N.O. or N.C., meaning normally-open and normally-closed.
Programming is also simple for the aforementioned parallel connection of N.O., N.O., and N.C. contacts where one would write:
Programming simplicity, however, can be retained when series and parallel operations are intermixed only if all paralleled contacts are connected to the left line as illustrated in FIG. 2. The instructions for this example would be:
The early prior art controllers required parallel contacts to be connected in this fashion; most of the small ones still do. This means that a diagram such as FIG. 3 must be modified as shown in FIG. 4 by introducing a coil to get the single contact going to the left line since you can "OR" only a single contact with the previous result. The added elements increase the cost.
It is desirable to have a programming means which accommodates such configurations as FIG. 3 without requiring the user to modify his diagram. This could be done if means within the processor were provided to store and retrieve the partial results of the logic operation. The program for FIG. 3 might then be written:
______________________________________ SERIES N.O. 1CR RETRIEVE T1 STORE T1 SERIES N.O. 4CR SERIES N.O. 2CR SERIES N.O. 5CR SERIES N.O. 3CR OR T2 STORE T2 ______________________________________
The action is as follows: at the first branch, it is recognized that one will have to come back later and compute the alternative parallel branch. Accordingly, the logic value at that point is stored in location T1 of a memory present for this purpose. When the first branch has been transversed, the logic value at this point is also stored in location T2 of that memory. The programmer then backs up and retrieves the value in location T1 to start the second branch. The result at the end of the second branch is OR'd with the value in location T2.
The procedure outlined is available in certain prior art large controllers and in at least one small controller. The large controllers provide cathode-ray tube diagram monitors which simplify the task of storing and retrieving temporary logic results. However, programming can become difficult without such aids when diagrams become complex, for the programmer must then keep track of a number of temporary results, storing and retrieving them as required. It is especially difficult for maintenance men to grasp the logic being performed by a list of instructions as given above. Accordingly, it is desirable to provide improved means that are simple and easy to program and does not require any diagram modification.